package com.fly.student.action;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fly.student.dao.StudentDao;

import base.util.Result;

@RestController
public class StudentAction {

	@Autowired
	private StudentDao studentDao;
	
	@Autowired
    private RedisTemplate<String, String> redisTemplate;

	@GetMapping("/index")
	public Result findAll() {
		List<Map<String, Object>> add = studentDao.add();
		return new Result("000", "你好", add);
	}
	
	@GetMapping("/redis")
	public String redis() {
		ValueOperations<String, String> ops = redisTemplate.opsForValue();
		String cache = ops.get("jeff");
		return cache;
	}
	
}
